import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [{
    path: '/guanliHome',
    name: 'guanliHome',
    component: () => import('../views/Guanli/GuanliHome.vue'),
    children: [{
        path: '/guanliHome/sendMsg',
        name: 'sendMsg',
        component: () => import('../views/Guanli/sendMsg.vue'),
      meta: {
        isLogin: true,
        roles: '设置'
      },
      },{
        path: '/guanliHome/shouye',
        name: 'shouye',
        component: () => import('../views/Guanli/shouye.vue'),
      meta: {
        isLogin: true,
        roles: ''
      },
      }, {
        path: '/guanliHome/rightsMng',
        name: 'rightsMng',
        component: () => import('../views/Guanli/RightsMng.vue'),
      meta: {
        isLogin: true,
        roles: '设置'
      },
      },
      /* 啊都 */
      {
        path: '/guanliHome/youHuiQuan',
        name: 'youHuiQuan',
        component: () => import('../views/Guanli/youHuiQuan.vue'),
        meta: {
          isLogin: true,
          roles: '优惠券管理'
        },
      },
      {
        path: '/guanliHome/baoXianGongsi',
        name: 'baoXianGongsi',
        component: () => import('../views/Guanli/baoXianGongsi.vue'),
        meta: {
          isLogin: true,
          roles: '保险管理'
        },
      },
      {
        path: '/guanliHome/changePassword',
        name: 'changePassword',
        component: () => import('../views/Guanli/changePassword.vue'),
        meta: {
          isLogin: true,
          roles: '修改密码'
        },
      },
      /* 亚亚 */
      {
        path: '/guanliHome/city',
        name: 'city',
        component: () => import('../views/Guanli/city.vue'),
        meta: {
          isLogin: true,
          roles: '设置'
        },
      },{
        path: '/guanliHome/guanlipingjia',
        name: 'guanlipingjia',
        component: () => import('../views/Guanli/guanlipingjia.vue'),
        meta: {
          isLogin: true,
          roles: '评价管理'
        },
      },
      /* yzyz */
      {
        path: '/guanliHome/dingdan',
        name: 'dingdan',
        component: () => import('../views/Guanli/dingdan.vue'),
        meta: {
          isLogin: true,
          roles: '订单管理'
        },
      },
      /* 蒋佳余 */
      {
        path: '/guanliHome/yonghuguanli',
        name: 'yonghuguanli',
        component: () => import('../views/Guanli/yonghuguanli.vue'),
        meta: {
          isLogin: true,
          roles: '客户管理'
        },
      },
      {
        path: '/guanliHome/chezhuka',
        name: 'chezhuka',
        component: () => import('../views/Guanli/chezhuka.vue'),
        meta: {
          isLogin: true,
          roles: '客户管理'
        },
      },{
        path: '/guanliHome/sijiguanli',
        name: 'sijiguanli',
        component: () => import('../views/Guanli/sijiguanli.vue'),
        meta: {
          isLogin: true,
          roles: '客户管理'
        },
      },
      /* 付洪铝 */
      {
        path: '/guanliHome/pingpai',
        name: 'pingpai',
        component: () => import('../views/Guanli/pingpai.vue'),
        meta: {
          isLogin: true,
          roles: '内容管理'
        },
      },{
        path: '/guanliHome/foursdian',
        name: 'foursdian',
        component: () => import('../views/Guanli/foursdian.vue'),
        meta: {
          isLogin: true,
          roles: '内容管理'
        },
      },{
        path: '/guanliHome/xiulidian',
        name: 'xiulidian',
        component: () => import('../views/Guanli/xiulidian.vue'),
        meta: {
          isLogin: true,
          roles: '内容管理'
        },
      },{
        path: '/guanliHome/kuaixiudian',
        name: 'kuaixiudian',
        component: () => import('../views/Guanli/kuaixiudian.vue'),
        meta: {
          isLogin: true,
          roles: '内容管理'
        },
      },
      /* 罗涛 */
      {
        path: '/guanliHome/baodan',
        name: 'baodan',
        component: () => import('../views/Guanli/baodan.vue'),
        meta: {
          isLogin: true,
          roles: '保险管理'
        },
      },
     /* 杨璐 */
      {
        path: '/guanliHome/tuikuan',
        name: 'tuikuan',
        component: () => import('../views/Guanli/tuikuan.vue'),
        meta: {
          isLogin: true,
          roles: '退款管理'
        },
      },
      {
        path: '/payGeteWay',
        name:'payGeteWay',
        component: () => import('../views/Guanli/zhifu.vue'),
      }
    ]
  },
  {
    path: '/carHome',
    name: 'carHome',
    component: () => import('../views/Car/CarHome.vue'),
    children: [{
        path: '/carHome/carMain',
        name: 'carMain',
        component: () => import('../views/Car/carMain.vue'),
      meta: {
        isLogin: true,
        roles: '司机端'
      },
      },
      {
        path: '/carHome/carInfo',
        name: 'carInfo',
        component: () => import('../views/Car/CarInfo.vue'),
        meta: {
          isLogin: true,
          roles: '司机端'
        },
      },
      {
        path: '/carHome/carNews',
        name: 'carNews',
        component: () => import('../views/Car/CarNews.vue'),
        meta: {
          isLogin: true,
          roles: '司机端'
        },
      },
      {
        path: '/carHome/carOrder',
        name: 'carOrder',
        component: () => import('../views/Car/CarOrder.vue'),
        meta: {
          isLogin: true,
          roles: '司机端'
        },
      },
      {
        path: '/carHome/changePwd',
        name: 'changePwd',
        component: () => import('../views/Car/ChangePwd.vue'),
        meta: {
          isLogin: true,
          roles: '司机端'
        },
      },
      {
        path: '/carHome/userPinjia',
        name: 'userPinjia',
        component: () => import('../views/Car/userPinjia.vue'),
        meta: {
          isLogin: true,
          roles: '司机端'
        },
      },
    ]
  },
  {
    path: '/userHome',
    name: 'userHome',
    component: () => import('../views/User/UserHome.vue'),
    children: [{
      path: '/userHome/userMain',
      name: 'userMain',
      component: () => import('../views/User/UserMain.vue') ,
      meta: {
        isLogin: true,
        roles: '用户端'
      },
    }, {
      path: '/userHome/userMsg',
      name: 'userMsg',
      component: () => import('../views/User/userMsg.vue') ,
      meta: {
        isLogin: true,
        roles: '用户端'
      },
    }, 
    /*杨璐  */
    {
      path: '/userHome/gerenxinxi',
      name: 'gerenxinxi',
      component: () => import('../views/User/gerenxinxi.vue'),
      meta: {
        isLogin: true,
        roles: '用户端'
      },
    },
      {
        path: '/userHome/usercarcard',
        name: 'usercarcard',
        component: () => import('../views/User/usercarcard.vue'),
        meta: {
          isLogin: true,
          roles: '用户端'
        },
      },
      {
        path: '/userHome/userInsurance',
        name: 'userInsurance',
        component: () => import('../views/User/userInsurance.vue'),
        meta: {
          isLogin: true,
          roles: '用户端'
        },
      },
    /* yzyz */
     {
      path: '/userHome/userdingdan',
      name: 'userdingdan',
      component: () => import('../views/User/userdingdan.vue') ,
       meta: {
         isLogin: true,
         roles: '用户端'
       },
    },
    /* 阿都 */
    {
      path: '/userHome/userchangepwd',
      name: 'userchangepwd',
      component: () => import('../views/User/userchangepwd.vue') ,
      meta: {
        isLogin: true,
        roles: '用户端'
      },
    }, 
  ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    redirect: '/login'
  }
]

const router = new VueRouter({
  routes
})

export default router